import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'
import Dashboard from '../views/Dashboard.vue'
import ShopList from '../views/ShopList.vue'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/',
      redirect:'Dashboard',
      component: () => import('../components/Layout/index.vue'),
      children: [
        {
          path: 'Dashboard',
          name: 'Dashboard',
          component: Dashboard,
          meta: {
            menu: true,
            title: '仪表盘',
            icon: 'DataLine'
          }
        },
        {
          path: 'shops',
          name: 'ShopList',
          component: ShopList,
          meta: {
            menu: true,
            title: '商店管理',
            icon: 'Shop'
          }
        },
        {
          path: '/products',
          name: 'Products',
          component: () => import('../views/products/ProductList.vue'),
          meta: {
            menu: true,
            title: '商品管理',
            icon: 'Shop'
          }
        },
        {
          path: '/products/add',
          name: 'AddProduct',
          component: () => import('../views/products/ProductForm.vue')
        },
        {
          path: '/products/edit/:id',
          name: 'EditProduct',
          component: () => import('../views/products/ProductForm.vue')
        }
      ]
    }
  ]
})

export default router 